! function(w) {
	"use strict";
	var d=document,isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',script_prefix_route=function(){//当前访问路径
		var e = d.currentScript ? d.currentScript.src : function() {
				console.log(d.scripts);
			for (var e, n = d.scripts, o = n.length - 1, r = o; r > 0; r--)
				if ("interactive" === n[r].readyState) {
					e = n[r].src;
					break
				}
			return e || n[o].src
		}();
		return e.substring(0, e.lastIndexOf("/") + 1)
	}();
	w._hcinits={
		'config':{},
	 	'version':'1.0.0',
		'm_arr_max_length':0,//最大加载js数量
		'm_arr_cur_length':0,//当前加载第几个
		'start_logs':0,
		'model_arr':{},//当前加载js
		'model_arr_exist':{},//已经加载js 
		'init_callback':null,
		'head':function(){
			return d.getElementsByTagName('head')[0];
		},
		'onloadstatus':function(script,e, url,returnfunction){
			var readyRegExp = navigator.platform === 'PLaySTATION 3' ? /^complete$/ : /^(complete|loaded)$/
			if (e.type === 'load' || (readyRegExp.test((e.currentTarget || e.srcElement).readyState))) {
				this.head().removeChild(script);
				this.onloadcallback(returnfunction);
			}
		},
		'onloadcallback':function(returnfunction){
			this.m_arr_cur_length++;
			if(this.m_arr_cur_length==this.m_arr_max_length){
				this.init_callback();
			}else{
				this.createscript(this.model_arr[this.m_arr_cur_length],returnfunction);
			}
		},
		'init':function(m_arr,returnfunction){
			m_arr = "string" == typeof m_arr ? [m_arr] : m_arr;
			this.model_arr=m_arr;
			this.m_arr_max_length=m_arr.length;
			this.m_arr_cur_length=0;//加载第一个
			this.createscript(m_arr[0],returnfunction);
		},
		'createscript':function(m_one,returnfunction){
			this.init_callback=returnfunction;
			if(this.model_arr_exist[m_one]){//是否已经加载
				this.onloadcallback(returnfunction);
			}else{//未加载
				var curthis=this;
				var script = d.createElement('script');
				script.type = 'text/javascript';
				script.charset = 'UTF-8';
				script.async = true;
				var url=script_prefix_route+'models/'+m_one+'.js';
				script.src = url+'?version='+this.version;
				this.head().appendChild(script);
				this.model_arr_exist[m_one]=url;
				if (script.attachEvent && !(script.attachEvent.toString && script.attachEvent.toString().indexOf('[native code') < 0) && !isOpera) {
					script.attachEvent('onreadystatechange', function (e) {
						curthis.onloadstatus(script,e, url,returnfunction);
					});
				} else {
					script.addEventListener('load', function (e) {					
						curthis.onloadstatus(script,e, url,returnfunction);
					}, false);
				}
			}
		},
		'device':function(){
			//获取设备信息
			var sys = {};
			var ua = navigator.userAgent.toLowerCase();
			var s;
			(s = ua.match(/edge\/([\d.]+)/)) ? sys.edge = s[1] :
			(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? sys.ie = s[1] :
			(s = ua.match(/msie ([\d.]+)/)) ? sys.ie = s[1] :
			(s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] :
			(s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] :
			(s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] :
			(s = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0;
			if (sys.edge) return { broswer : "Edge", version : sys.edge };
			if (sys.ie) return { broswer : "IE", version : sys.ie };
			if (sys.firefox) return { broswer : "Firefox", version : sys.firefox };
			if (sys.chrome) return { broswer : "Chrome", version : sys.chrome };
			if (sys.opera) return { broswer : "Opera", version : sys.opera };
			if (sys.safari) return { broswer : "Safari", version : sys.safari };
			return { broswer : "", version : "0" };
		},
	};
}(window)